﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace WebHousingInfo.Controls
{
    public partial class ThongTinNgoaiTe : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            DataSet ds = new DataSet();
            try
            {
                ds.ReadXml("http://vietcombank.com.vn/exchangerates/exratexml.aspx");
                // lay tu Vietcomnbank

                DataTable dt = ds.Tables[1];
                DataRow[] dr = dt.Select("CurrencyCode = 'USD' or CurrencyCode = 'SGD' or CurrencyCode = 'HKD' or CurrencyCode = 'JPY' or CurrencyCode = 'AUD' or CurrencyCode = 'EUR' or CurrencyCode = 'GBP'");


                DataTable dtresult = dt.Clone();

                for (int i = 0; i < dr.Length; i++)
                {
                    DataRow d = dtresult.NewRow();
                    d[0] = dr[i][0];
                    d[1] = dr[i][1];
                    d[2] = dr[i][2];
                    d[3] = dr[i][3];
                    d[4] = dr[i][4];
                    dtresult.Rows.Add(d);
                }


                GridViewControl.DataSource = dtresult;
                GridViewControl.DataBind();

            }
            catch
            {
                //Server.Transfer("~/Error/ErrorNetwork.aspx");
            }
        }
    }
}